<template>
  <div>
    <el-dialog :title="'会员编辑'" :visible.sync="obj.isTrue">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="手机号">
          <el-input v-model="form.phone"></el-input>
        </el-form-item>
        <el-form-item label="昵称">
          <el-input v-model="form.nickname"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="form.password"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel()">取 消</el-button>

        <el-button type="primary" @click="dit()">编辑</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import {
  memberInfo,
  memberEdit,
} from "../../../requster/api";
import { successAlert, warningAlert } from "../../../util/alter";


export default {
  props: ["obj"],
  components: {},
  data() {
    return {
      form: {
        uid: "",
        nickname: "",
        phone: "",
        password: "",
        status: 1,
      },
    };
  },
  computed: {
    ...mapGetters({
      memberList: "member/list",
      
    }),
  },
  methods: {
    //   获取一条信息
    getone(uid) {
      memberInfo({ uid: uid }).then((res) => {
        this.form = res.data.list;
      });
    },
    //   点击编辑
    dit() {
      memberEdit(this.form).then((res) => {
        if (res.data.code == 200) {
          successAlert(res.data.msg);
          this.cancel();
          this.reqmemberlist();
        } else {
          warningAlert(res.data.msg);
        }
      });
    },
    //   清空封装
    empt() {
      this.form = {
        uid: "",
        nickname: "",
        phone: "",
        password: "",
        status: 1,
      };
    },
    // 点击取消
    cancel() {
      this.obj.isTrue = false;
      this.empt();
    },
    ...mapActions({
      reqmemberlist: "member/reqChangeList",
    }),
  },
  mounted() {
    this.reqmemberlist();
    
  },
};
</script>
<style scoped>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>